package com.gz.logistics.library.pojo;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 杜志娟 on 2016-04-27.
 */
public class ClothesColor extends CustomerSpinnerObject{
    private int id;
    private String color;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }
    @Override
    public String toString(){return color;}
    public static List<ClothesColor> parse(JSONArray jsonArray) throws JSONException {
        if (jsonArray == null || jsonArray.length() <= 0){
            return null;
        }
        List<ClothesColor> colorlist = new ArrayList<ClothesColor>();
        for (int i = 0 ; i < jsonArray.length() ; i ++ ){
            ClothesColor info = new ClothesColor();
            info.id = (jsonArray.getJSONObject(i)).getInt("id");
            info.color = (jsonArray.getJSONObject(i)).getString("colour");
            colorlist.add(info);
        }
        return colorlist;
    }
}
